#include "EditApplication.h"
#include <SEWindow/SDLWindow/SDLWindow.h>
#include <SEUi/Layers/ImguiLayer.h>
#include <SERender/Drive/Drive.h>
#include <SEngine/Layers/SceneLayer.h>
#include <SEEdit/Layer/GuideLayer.h>
#include <SECore/Manager.h>
#include <SECore/Config.h>
#include <SEJsonConfig/JsonConfigLoader.h>


namespace SEngine
{
    void EditApplication::Init()
    {
        LoadConfigs();
        const float delta = 0.8f;
        auto window = std::make_unique<SDLWindow>("SEngine", (int)(1920 * delta), (int)(1080 * delta), SDLWindowFlags::SE_WINDOW_OPENGL | SDLWindowFlags::SE_WINDOW_RESIZABLE);
        PushBackLayer("GuideLayer", std::make_unique<GuideLayer>(*this));
        PushBackLayer("ImguiLayer", std::make_unique<ImguiLayer>(*this, *window));
        SetWindow(std::move(window));
        CurrentDrive().EnableMultiSample(true);
        CoreApplication::Init();
    }

    void EditApplication::LoadConfigs()
    {
        Manager::GetInstance().Register<ConfigNode>("SEConfig", "./Configs/SEConfig.json", std::make_unique<ConfigNode>(JsonConfigLoader().Load("./Configs/SEConfig.json")));
    }

} // namespace SEngine

